import { defineStore } from "pinia";
import { reactive } from "vue";
import type LoginUser from "@/types/LoginUser";

/**
 * 用户仓库
 */
export const useUserStore = defineStore("userStore",()=>{

    /**
     * 登录用户信息
     */
    const user = reactive<LoginUser>({
        id: -1,
        username: "",
        avatar: "",
        authorities: "",
        token: ""
    })

    return {user}
},{
    persist:{
        key: 'user_store',
        paths: ['user']
    }
})